home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / develop / libsrc11.arc / RDBYTSCI.C < prev    next >
C/C++ Source or Header  |  1989-04-27  |  1KB  |  42 lines

  1. /*    rdbytsci.c 4.3        */
  2. /*F****************************************************************************
  3.  
  4. FUNCTION NAME:    rdbytsci
  5.  
  6. ACTION:        Reads a character from the SCI serial hardware.
  7.         Returns an integer containing status and data.
  8.         The upper byte of the integer returned is composed
  9.         of the SCI status register and the 9th data bit.
  10.         The low byte returned is the low 8 bits of the data
  11.         read.
  12.  
  13. PARAMETERS:    (None)
  14.  
  15. RETURNS:    (unsigned) BigByte:    bits 15-9 = 68HC11 SCSR register
  16.                     bit     8 = 9th data bit (if sent)
  17.                     bits  7-0 = data byte
  18.  
  19. ******************************************************************************/
  20.  
  21. #define    NINTH_BIT    0x100    /* Ninth data bit */
  22.  
  23. #include <hc11/io.h>
  24. #include <hc11/sci.h>
  25. #include <hc11/directives.h>
  26.  
  27. SMALL
  28. unsigned rdbytsci()
  29.  
  30.     {
  31.  
  32.     while ((HC11.SCSRDAT.STATUS&RDRF) ==  0)
  33.             ;    /* Null Statement */
  34.  
  35.  
  36.     if (HC11.SCCR1 & R8)
  37.         return(HC11.SCSRDAT.STATDATA | NINTH_BIT);
  38.     else
  39.         return(HC11.SCSRDAT.STATDATA);
  40.  
  41.     }    /* end of rdbytsci    */
  42.